package test.pcs;

import com.alibaba.fastjson.JSON;
import com.payment.lc.pcs.client.wrap.bo.ProductionALLAttributes;
import com.payment.lc.pcs.client.wrap.bo.ProductionChannelAttributes;
import com.payment.lc.pcs.client.wrap.bo.ProductionPurchaseAttributes;
import com.payment.lc.pcs.client.wrap.bo.ProductionTimeAttributes;
import com.payment.lc.pcs.client.wrap.model.ZiGuanTime;
import com.payment.lc.pcs.client.wrap.service.ProductionWrapService;
import com.payment.lc.pcs.common.enums.BizType;
import com.payment.lc.pcs.service.api.AppSettingService;
import com.payment.lc.pcs.service.api.DynamicDataService;
import com.payment.lc.pcs.service.api.ProductionService;
import com.payment.lc.pcs.service.api.fund.JMFundService;
import com.payment.lc.pcs.service.api.modify.InterestRateService;
import com.payment.lc.pcs.service.api.modify.PcsChannelService;
import com.payment.lc.pcs.service.bo.ProductionSellInfo;
import com.payment.lc.pcs.service.domain.*;
import com.payment.lc.pcs.service.request.InterestRateImportRequest;
import com.payment.lc.pcs.service.response.BaseResponse;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import test.BaseTest;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * Created on 2016/8/8.
 */
public class Demo3PcsClientTest1 extends BaseTest {

    @Autowired
    ProductionService productionService;

    @Autowired
    JMFundService jmFundService;

    @Autowired
    ProductionWrapService productionWrapService;

    @Autowired
    InterestRateService interestRateService;

    @Autowired
    DynamicDataService dynamicDataService;

    @Autowired
    PcsChannelService pcsChannelService;

    @Autowired
    AppSettingService appSettingService;

    @Test
    public void test() {
        test4();
    }

    static String prodCode = "17120015";
//    static String prodCode = "JM000509";
//    static String prodCode = "ZG0001";

    @Value("${ps.address}")
    public String s;

    void test4() {
        System.out.println("s = " + s);
        System.out.println(s.startsWith("$"));

    }
    void test2() {
        ProductionBizInfo biz = productionService.getBiz(prodCode, BizType.Fundin);
        System.out.println();
    }
    void test1() {
        {
            ListWrapper<PaymentChannel> bankList = productionService.getBankList(prodCode, BizType.Fundin);
            display(bankList);

            List<PaymentChannel> bankList1 = productionWrapService.getBankList(prodCode, BizType.Fundin);
            display(bankList1);

            System.out.println(JSON.toJSONString(bankList.getList()).equals(JSON.toJSONString(bankList1)));

            ListWrapper<PaymentChannel> paymentLimit = productionService.getPaymentLimit(prodCode);
            display(paymentLimit);
        }
        System.out.println();
        System.out.println();
        {
            List<PaymentChannel> bankList = JSON.parseArray(bankListStr, PaymentChannel.class);
            com.payment.lc.pcs.service.response.BaseResponse resp = pcsChannelService.importBankLimits("KT10112", bankList);
            display(resp);
        }

        System.out.println();
        System.out.println();

        {
            ListWrapper<PaymentChannel> bankList = productionService.getBankList(prodCode, BizType.Fundin);
            display(bankList);

            List<PaymentChannel> bankList1 = productionWrapService.getBankList(prodCode, BizType.Fundin);
            display(bankList1);

            System.out.println(JSON.toJSONString(bankList.getList()).equals(JSON.toJSONString(bankList1)));
        }
    }

    void test3() {

        display(productionWrapService.getBankList(prodCode, BizType.Fundin));

        List<PaymentChannel> bankList = JSON.parseArray(bankListStr, PaymentChannel.class);

        com.payment.lc.pcs.service.response.BaseResponse resp = pcsChannelService.importBankLimits("KT102", bankList);
        display(resp);

        display(productionWrapService.getBankList(prodCode, BizType.Fundin));
    }

    static String bankListStr = "[\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"中国农业银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"ABC\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 200000.00,\n" +
            "    \"dailyMaxAmount\": 5000000.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"中国银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"BOC\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 200000.00,\n" +
            "    \"dailyMaxAmount\": 5000000.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"中国建设银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"CCB\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 200000.00,\n" +
            "    \"dailyMaxAmount\": 5000000.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"交通银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"COMM\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 200000.00,\n" +
            "    \"dailyMaxAmount\": 5000000.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"中国光大银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"CEB\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 200000.00,\n" +
            "    \"dailyMaxAmount\": 5000000.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"广发银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"GDB\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 200000.00,\n" +
            "    \"dailyMaxAmount\": 5000000.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"平安银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"SZPAB\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 200000.00,\n" +
            "    \"dailyMaxAmount\": 5000000.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"中国民生银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"CMBC\",\n" +
            "    \"status\": \"Valid\"\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"华夏银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"HXB\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 200000.00,\n" +
            "    \"dailyMaxAmount\": 5000000.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"浦发银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"SPDB\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 200000.00,\n" +
            "    \"dailyMaxAmount\": 5000000.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"兴业银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"CIB\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 200000.00,\n" +
            "    \"dailyMaxAmount\": 5000000.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"北京银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"BCCB\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 200000.00,\n" +
            "    \"dailyMaxAmount\": 5000000.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"上海银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"BOS\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 50000.00,\n" +
            "    \"dailyMaxAmount\": 70000.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"中信银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"CITIC\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 200000.00,\n" +
            "    \"dailyMaxAmount\": 5000000.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"其他银行\",\n" +
            "    \"memo\": \"mipay test\",\n" +
            "    \"bankCode\": \"OTHER\",\n" +
            "    \"status\": \"Valid\"\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"中国工商银行\",\n" +
            "    \"bankCode\": \"ICBC\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 200000.00,\n" +
            "    \"dailyMaxAmount\": 5000000.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"招商银行\",\n" +
            "    \"bankCode\": \"CMB\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 50000.00,\n" +
            "    \"dailyMaxAmount\": 0.00\n" +
            "  },\n" +
            "  {\n" +
            "    \"channelCode\": \"KT102\",\n" +
            "    \"name\": \"中国邮政储蓄银行\",\n" +
            "    \"bankCode\": \"PSBC\",\n" +
            "    \"status\": \"Valid\",\n" +
            "    \"singleMaxAmount\": 200000.00,\n" +
            "    \"dailyMaxAmount\": 0.00\n" +
            "  }\n" +
            "]";
}